package bocchi.card;

import bocchi.base.BaseCustomCard;
import bocchi.BocchiCore;
import bocchi.base.BaseCustomPower;
import bocchi.general.Util;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.AbstractPower;

public class BiggestFans extends BaseCustomCard {
    public static final String RAW_ID = BiggestFans.class.getSimpleName();
    public static final String GAME_ID = BocchiCore.getGameID(RAW_ID);

    public BiggestFans() {
        super(RAW_ID);
    }

    @Override
    public void use(AbstractPlayer player, AbstractMonster monster) {
        BaseCustomPower power = new BaseCustomPower(RAW_ID, AbstractPower.PowerType.BUFF, player, 1) {
            private int finaleThisTurn = 0;

            @Override
            public void atStartOfTurn() {
                finaleThisTurn = 0;
            }

            @Override
            public void onFinale() {
                finaleThisTurn++;
                if (finaleThisTurn > amount) return;

                addToTop(new GainEnergyAction(1));
                addToTop(new DrawCardAction(1));
            }
        };

        Util.applyPower(player, player, power);
    }
}
